*REGRESSION TABLES AND DESCRIPTIVES*
 
use "master_file_with_fuels_emissions_w_inv_v2_new.dta", clear 

rename sni2007_4d sni2007_4d_old
destring sni2007_4d_old, generate(sni2007_4d)

****GET LEAKAGE LIST INDICATOR
sort sni2007_4d
merge m:1 sni2007_4d using "export_leakage.dta"
drop _merge

****GET LABOR TAX RATES
sort year 
merge m:1 year using "labor taxes.dta"
drop _merge

tsset bidnr year

keep if sni2007_2d>9 & sni2007_2d<34
keep if year<2016

gen no_bigpre2007=0
replace no_bigpre2007=1 if bidnr==1818849 | bidnr==1661275

drop if no_bigpre2007==1

tsspell, f(L.year == .)
egen length = max(_seq), by(bidnr _spell)
keep if length >= 4

**BALANCE PANEL
by bidnr: gen nyear=[_N]

replace marginal_cost=0 if year==1990

***EI SORT
gen z_q_1=((1000000*kt_co2foss))/sales_ppi_12month
gen z_q_2=((1000000*kt_co2foss))/sales_defl_12month

egen or_co2_90=sum(kt_co2foss) if year==1990 & z_q_1<., by(sni2007_4d)
egen or_salesppi_90=sum(sales_ppi_12month) if year==1990 & z_q_1<., by(sni2007_4d)
egen co2_90=max(or_co2_90), by(sni2007_4d)
egen salesppi_90=max(or_salesppi_90), by(sni2007_4d)
gen or_ei_sum_90=(1000000*co2_90)/salesppi_90
egen ei_sum_90=max(or_ei_sum_90), by(bidnr)

****FOR CONSOLIDATED SAMPLE
*RUN "keep if year>1995" WHEN "****SAMPLE 1996-2015***" IS INDICATED NEXT TO THE NAME OF THE TABLE, OTHERWISE RUN THE CODE WITH FULL SAMPLE

****DECLARE VARIABLES

***DEP VAR
winsor z_q_1, gen(z_q_1_w) p(0.01)
gen or_ln_zq=ln(1+z_q_1)
winsor or_ln_zq, gen(ln_zq) p(0.01)

gen or_cap_emp=ppe/antanst
winsor or_cap_emp, gen(cap_emp) p(0.01)
gen l_cap_emp=log(cap_emp)

gen carbon_tax_ebit=carbon_tax_defl/ebit_defl
winsor carbon_tax_ebit, gen(carbon_tax_ebit_w) p(0.01)

gen co2tax_sort_sales=carbon_tax_marg/sales_ppi_12month
gen or_co2tax_sales= carbon_tax_defl/sales_defl
winsor or_co2tax_sales, gen(co2tax_sales) p(0.01)
gen l_co2tax_sales=log(co2tax_sales)

gen or_cap_emp_use=(ppe/1000000)/antanst
winsor or_cap_emp_use, gen(cap_emp_use) p(0.01)
gen log_cap_emp_use=log(cap_emp_use)

gen or_log_emp=log(antanst)
winsor or_log_emp, gen(log_emp) p(0.01)

****FOR MAIN REGS

gen or_marginal_cost_emission_y= (marginal_cost*1000000*kt_co2foss)/sales_ppi_12month
winsor or_marginal_cost_emission_y, gen(marginal_cost_emission_y) p(0.01)
gen ln_marginal_cost_emission_y =ln(1 + marginal_cost_emission_y)

**MAIN EXPL VAR
gen or_frac_taxpaidmc_y=1-or_marginal_cost_emission_y
winsor or_frac_taxpaidmc_y , gen(frac_taxpaidmc_y) p(0.01)
gen ln_frac_taxpaidmc_y =ln( frac_taxpaidmc_y )

gen ln_frac_taxpaidmc_y_eu=ln_frac_taxpaidmc_y*eu

gen or_marginal_cost_emission_ebit= (marginal_cost*1000000*kt_co2foss)/ebit_defl
winsor or_marginal_cost_emission_ebit, gen(marginal_cost_emission_ebit) p(0.01)

gen or_frac_taxpaidmc_ebit=1-or_marginal_cost_emission_ebit
winsor or_frac_taxpaidmc_ebit , gen(frac_taxpaidmc_ebit) p(0.01)
gen ln_frac_taxpaidmc_ebit =ln( frac_taxpaidmc_ebit )

****PACE AND MOBILITY

gen plant_sales=real_capstock/sum_sales

gen air_pace= (invfluft+ invbluft+ luftdukosti +luftdukoste)*1000

egen air_pace_sy=sum(air_pace), by(sni2007_4d year)
egen sales_sy=sum(ntoms), by(sni2007_4d year)
gen or_sw_air_pace_sales=air_pace_sy/sales_sy
egen sw_air_pace_sales=mean(or_sw_air_pace_sales), by(sni2007_4d)

gen share_structures_capx=IBygg/(IBygg+IMask)
gen real_structures_cap_stock=share_structures_capx*ppe

egen rstruct_cs_sy=sum(real_structures_cap_stock), by(sni2007_4d year)
gen or_sw_rstruc_cs_sales=rstruct_cs_sy/sales_sy
egen sw_rstruc_cs_sales=mean(or_sw_rstruc_cs_sales), by(sni2007_4d)

gen sw_rstruc_cs_sales_adj=sw_rstruc_cs_sales
replace sw_rstruc_cs_sales_adj=0.0172654 if sni2007_4d==2351
replace sw_rstruc_cs_sales_adj=0.0172654 if sni2007_4d==2352

****PACE FIRM LEVEL INV AND COSTS

gen air_pace_inv= (invfluft+ invbluft)*1000
gen or_air_pace_inv_y=air_pace_inv/ntoms
gen ln_air_pace_inv_y=ln(1+or_air_pace_inv_y)

gen air_pace_opx= (luftdukosti +luftdukoste)*1000
gen or_air_pace_opx_y=air_pace_opx/ntoms
gen ln_air_pace_opx_y=ln(1+or_air_pace_opx_y)

***EU ETS
egen eu_firm=max(eu), by(bidnr)

gen lp_firm=0
replace lp_firm=1 if sw_air_pace_sales>0 & sw_air_pace_sales<=0.0001225

gen hp_firm=0
replace hp_firm=1 if sw_air_pace_sales>0.0001225 & sw_air_pace_sales<=0.0222185

gen lm_firm=0
replace lm_firm=1 if sw_rstruc_cs_sales_adj>0.008478 & sw_rstruc_cs_sales_adj<=0.6276603

gen hm_firm=0
replace hm_firm=1 if sw_rstruc_cs_sales_adj>0 & sw_rstruc_cs_sales_adj<=0.008478

gen lp_lm_firm=0
replace lp_lm_firm=1 if sw_air_pace_sales>0 & sw_air_pace_sales<=0.0001225 & sw_rstruc_cs_sales_adj>0.008478 & sw_rstruc_cs_sales_adj<=0.6276603

gen lp_hm_firm=0
replace lp_hm_firm=1 if sw_air_pace_sales>0 & sw_air_pace_sales<=0.0001225 & sw_rstruc_cs_sales_adj>0 & sw_rstruc_cs_sales_adj<=0.008478

gen hp_lm_firm=0
replace hp_lm_firm=1 if sw_air_pace_sales>0.0001225 & sw_air_pace_sales<=0.0222185 & sw_rstruc_cs_sales_adj>0.008478 & sw_rstruc_cs_sales_adj<=0.6276603

gen hp_hm_firm=0
replace hp_hm_firm=1 if sw_air_pace_sales>0.0001225 & sw_air_pace_sales<=0.0222185 & sw_rstruc_cs_sales_adj>0 & sw_rstruc_cs_sales_adj<=0.008478

gen no_leakage_firm=0
replace no_leakage_firm=1 if leakage==0

gen leakage_firm=0
replace leakage_firm=1 if leakage>0 & leakage<8

gen leakage_trade_only_firm=0
replace leakage_trade_only_firm=1 if leakage==3

gen leakage_not_trade_only_firm=0
replace leakage_not_trade_only_firm=1 if leakage>0 & leakage<8 & leakage_trade_only_firm==0

gen d1_d4_firm=0
replace d1_d4_firm=1 if ei_sum_90>0 & ei_sum_90<=0.00159348

gen d5_d8_firm=0
replace d5_d8_firm=1 if ei_sum_90>0.00159348 & ei_sum_90<=0.00575538

gen d9_d10_firm=0
replace d9_d10_firm=1 if ei_sum_90>0.00569646 & ei_sum_90<=0.2751856

*****GENERATE DECILES
gen d1=0
replace d1=1 if ei_sum_90>0 & ei_sum_90<=0.00066385

gen d2=0
replace d2=1 if ei_sum_90>0.00066385 & ei_sum_90<=0.00094634

gen d3=0
replace d3=1 if ei_sum_90>0.00094634 & ei_sum_90<=0.00135005

gen d4=0
replace d4=1 if ei_sum_90>0.00135005 & ei_sum_90<=0.00159348

gen d5=0
replace d5=1 if ei_sum_90>0.00159348 & ei_sum_90<=0.0019806

gen d6=0
replace d6=1 if ei_sum_90>0.0019806 & ei_sum_90<=0.002615

gen d7=0
replace d7=1 if ei_sum_90>0.002615 & ei_sum_90<=0.00387795

gen d8=0
replace d8=1 if ei_sum_90>0.00387795 & ei_sum_90<=0.00569646

gen d9=0
replace d9=1 if ei_sum_90>0.00569646 & ei_sum_90<=0.01321059

gen d10=0
replace d10=1 if ei_sum_90>0.01321059 & ei_sum_90<=0.2751856

******CONSOLIDATED FIRM SORTS FOR PAPER

***PUBLIC VS PRIVATE
gen public_con=0
replace public_con=1 if con_sse==1 
replace public_con=1 if o_m==1

egen public_firm=max(public_con), by(bidnr)
gen private_firm=0
replace private_firm=1 if public_firm==0

egen or_public_firm_all=min(public_con), by(bidnr)
gen public_firm_all=0
replace public_firm_all=1 if or_public_firm_all==1

***FIRM SIZE
egen av_con_size_ta=mean(con_ta_defl), by(bidnr)
egen med_con_size_ta_nace4=median(av_con_size_ta), by(sni2007_4d)
gen rel_con_size_ta_nace4=av_con_size_ta/med_con_size_ta_nace4
gen large_firm=0
replace large_firm=1 if rel_con_size_ta_nace4>1
gen small_firm=0
replace small_firm=1 if rel_con_size_ta_nace4<=1

***DIVIDEND
gen con_div_ta=(con_dividend)/con_ta
winsor con_div_ta, gen(con_div_ta_w) p(0.01)
egen av_con_divta=mean(con_div_ta_w), by(bidnr)
egen med_con_divta_nace4=median(av_con_divta), by(sni2007_4d)
gen rel_con_divta_nace4=av_con_divta/med_con_divta_nace4
gen high_div_firm=0
replace high_div_firm=1 if rel_con_divta_nace4>1
gen low_div_firm=0
replace low_div_firm=1 if rel_con_divta_nace4<=1

****FOUNDING YEAR
egen med_founded_nace4=median(con_founded_n), by(sni2007_4d)
gen rel_founded_nace4=con_founded_n/med_founded_nace4
gen mature_firm=0
replace mature_firm=1 if  rel_founded_nace4<1
gen young_firm=0
replace young_firm=1 if  rel_founded_nace4>=1

*****COPORATE TAXES

gen or_taxes_sales=skatter/ntoms_12month
winsor or_taxes_sales, gen(taxes_sales) p(0.01)
gen ln_taxes_sales=ln(1+taxes_sales)

gen or_frac_inc_taxes_y=1-or_taxes_sales
winsor or_frac_inc_taxes_y , gen(frac_inc_taxes_y) p(0.01)
gen ln_frac_inc_taxes_y =ln( frac_inc_taxes_y )

****LABOR TAXES
gen labor_tax_paid=perskos*tax_rate_labor
gen or_labor_taxes_sales=labor_tax_paid/ntoms_12month
winsor or_labor_taxes_sales, gen(labor_taxes_sales) p(0.01)
gen ln_labor_taxes_sales=ln(1+labor_taxes_sales)

gen or_frac_labor_taxes_y=1-or_labor_taxes_sales
winsor or_frac_labor_taxes_y , gen(frac_labor_taxes_y) p(0.01)
gen ln_frac_labor_taxes_y =ln( frac_labor_taxes_y )

gen age=year-con_founded
gen ln_age=ln(1+age)

gen or_ln_ta=ln(con_ta_defl)
winsor or_ln_ta, gen(ln_ta) p(0.01)

gen or_ebit_sales=ebit/ntoms_12month
winsor or_ebit_sales, gen(ebit_sales) p(0.01)

***BANKING CRISES A LA LAEVEN AND VALENCIA
gen bc_event=0
replace bc_event=1 if year>1990 & year<1996
replace bc_event=1 if year>2007 & year<2010
gen ln_frac_taxpaidmc_y_bc=ln_frac_taxpaidmc_y*bc_event

*******************NEW FOR FINAL RESUBMISSION

*****NEW VARIABLES

***SA INDEX A LA HADLOCK AND PIERCE
gen firm_age=year-con_founded_n
gen or_ln_con_ta=ln(con_ta)
winsor or_ln_con_ta, gen(ln_con_ta) p(0.01)
gen sa_index=(-0.737*ln_con_ta)+(0.043*(ln_con_ta^2))-(0.040*firm_age)
egen av_con_sa=mean(sa_index), by(bidnr)
gen high_sa=0 //HIGH VALUES REPRESENT MORE CONSTRAINTS//
replace high_sa=1 if av_con_sa>=-.663938
gen low_sa=0
replace low_sa=1 if av_con_sa<-.663938

***WHITED WU INDEX

gen or_con_cf_ta=con_cash_flow_defl/con_ta_defl
winsor or_con_cf_ta, gen(con_cf_ta) p(0.01)
gen pos_div=0
replace pos_div=1 if con_dividend>0 & con_dividend<=1.01e+12
gen or_con_dbt_ta=con_total_debt/con_ta
winsor or_con_dbt_ta, gen(con_dbt_ta) p(0.01)
gen ln_ind_sales_gwth=ln(sales_industry_ppi_12month)
gen or_ind_s_gwth=d.ln_ind_sales_gwth
winsor or_ind_s_gwth, gen(ind_s_gwth) p(0.01)
gen ln_firm_sales_gwth=ln(con_sales_ppi_12month)
gen or_firm_s_gwth=d.ln_firm_sales_gwth
winsor or_firm_s_gwth, gen(firm_s_gwth) p(0.01)

gen ww_index=-0.091*con_cf_ta-0.062*pos_div+0.021*con_dbt_ta-0.044*ln_con_ta+0.102*ind_s_gwth-0.035*firm_s_gwth
egen av_con_ww=mean(ww_index), by(bidnr)
gen high_ww=0 //HIGH VALUES REPRESENT MORE CONSTRAINTS//
replace high_ww=1 if av_con_ww>=-.8544959
gen low_ww=0
replace low_ww=1 if av_con_ww<-.8544959

**FOR TABLE 2
gen summary_stats_sample=0
replace summary_stats_sample=1 if d.ln_zq<. & d.l.ln_frac_taxpaidmc_y<.

**FOR TABLE 5-6

**EXEMPTIONS 91-92
gen exemp_no_cement9192=0
replace exemp_no_cement9192=1 if year==1991 & co2tax_sort_sales>0.017 & co2tax_sort_sales<. & cement==0
replace exemp_no_cement9192=1 if year==1992 & co2tax_sort_sales>0.012 & co2tax_sort_sales<.  & cement==0
egen firm_exemp_no_cement9192=max(exemp_no_cement9192), by(bidnr)

**EXEMPTIONS 97
gen exemp_no_cement_97=0
replace exemp_no_cement_97=1 if year==1997 & co2tax_sort_sales>0.008& co2tax_sort_sales<. & cement==0
egen firm_exemp_no_cement_97=max(exemp_no_cement_97), by(bidnr)

egen n_firmyr_9300=count(nyear) if year>1992 & year<2001, by(bidnr)
egen n_firmyr_9600=count(nyear) if year>=1996 & year<2001, by(bidnr)


***EVENT WINDOW INDICATORS 91-92
gen y90_92=0
replace y90_92=1 if year<1993
gen y91_92=0
replace y91_92=1 if year>1990 & year<1993
gen y91_96=0
replace y91_96=1 if year>1990 & year<1997
gen y93_96=0
replace y93_96=1 if year>1992 & year<1997

***EVENT WINDOW INDICATORS 93-00
gen y93_00=0
replace y93_00=1 if year>1992 & year<2001
gen y97_00=0
replace y97_00=1 if year>1996 & year<2001

************TABLE 2
sum z_q_1_w marginal_cost_emission_y marginal_cost_emission_ebit antanst cap_emp_use eu_firm lp_firm hp_firm lp_lm_firm lp_hm_firm hp_lm_firm hp_hm_firm no_leakage_firm leakage_firm d1_d4_firm d5_d8_firm d9_d10_firm public_firm private_firm large_firm small_firm high_div_firm low_div_firm mature_firm young_firm if summary_stats_sample==1, det

************TABLE 3
***PANEL A & B
sum marginal_cost z_q_1_w if firm_exemp_no_cement9192==1 & year==1990 & d10==1  & z_q_1_w<.
sum marginal_cost z_q_1_w if firm_exemp_no_cement9192==0 & cement==0 & year==1990 & d10==1 & z_q_1_w<.
sum marginal_cost z_q_1_w if firm_exemp_no_cement9192==1 & year>1990 & year<1993 & d10==1 & z_q_1_w<.
sum marginal_cost z_q_1_w if firm_exemp_no_cement9192==0 & cement==0 & year>1990 & year<1993 & d10==1 & z_q_1_w<.
sum marginal_cost z_q_1_w if firm_exemp_no_cement9192==1 & year>1992 & year<1997 & d10==1 & z_q_1_w<.
sum marginal_cost z_q_1_w if firm_exemp_no_cement9192==0 & cement==0 & year>1992 & year<1997 & d10==1 & z_q_1_w<.

regress marginal_cost firm_exemp_no_cement9192##y91_92 if y90_92==1 & cement==0 & z_q_1_w<. & d10==1
regress z_q_1_w firm_exemp_no_cement9192##y91_92 if y90_92==1 & cement==0 & z_q_1_w<. & d10==1

regress marginal_cost firm_exemp_no_cement9192##y93_96 if y91_96==1 & cement==0 & z_q_1_w<. & d10==1
regress z_q_1_w firm_exemp_no_cement9192##y93_96 if y91_96==1 & cement==0 & z_q_1_w<. & d10==1

***PANEL C & D
sum marginal_cost z_q_1_w if firm_exemp_no_cement_97==0 & year>1992 & year<1997 & d10==1 & z_q_1_w<. & cement==0 & n_firmyr_9300==8
sum marginal_cost z_q_1_w if firm_exemp_no_cement_97==1 & year>1992 & year<1997 & d10==1 & z_q_1_w<. & cement==0 & n_firmyr_9300==8
sum marginal_cost z_q_1_w if firm_exemp_no_cement_97==1 & year>1996 & year<2001 & d10==1 & z_q_1_w<. & cement==0 & n_firmyr_9300==8
sum marginal_cost z_q_1_w if firm_exemp_no_cement_97==0 & year>1996 & year<2001 & d10==1 & z_q_1_w<. & cement==0 & n_firmyr_9300==8

regress marginal_cost firm_exemp_no_cement_97##y97_00 if y93_00==1 & cement==0 & z_q_1_w<. & d10==1 & n_firmyr_9300==8
regress z_q_1_w firm_exemp_no_cement_97##y97_00 if y93_00==1 & cement==0 & z_q_1_w<. & d10==1 & n_firmyr_9300==8

************TABLE 4 
reghdfe d.ln_zq d.l.ln_frac_taxpaidmc_y,a(year) vce(cluster bidnr)

reghdfe d.ln_zq d.l.ln_frac_taxpaidmc_y,a(bidnr year) vce(cluster bidnr)

reghdfe d.ln_zq d.l.ln_frac_taxpaidmc_y d.l2.ln_frac_taxpaidmc_y,a(bidnr year) vce(cluster bidnr)
test  d.l.ln_frac_taxpaidmc_y + d.l2.ln_frac_taxpaidmc_y =0

reghdfe d.ln_zq d.l.ln_frac_taxpaidmc_y d.l2.ln_frac_taxpaidmc_y d.l3.ln_frac_taxpaidmc_y,a(bidnr year) vce(cluster bidnr)
test  d.l.ln_frac_taxpaidmc_y + d.l2.ln_frac_taxpaidmc_y + d.l3.ln_frac_taxpaidmc_y =0

reghdfe d.ln_zq d.l.ln_frac_taxpaidmc_y d.l2.ln_frac_taxpaidmc_y d.l3.ln_frac_taxpaidmc_y,a(bidnr year#sni2007_4d) vce(cluster bidnr)
test  d.l.ln_frac_taxpaidmc_y + d.l2.ln_frac_taxpaidmc_y + d.l3.ln_frac_taxpaidmc_y =0

reghdfe d.ln_zq d.l.ln_frac_taxpaidmc_y d.l2.ln_frac_taxpaidmc_y d.l3.ln_frac_taxpaidmc_y if d1_d4_firm==1,a(bidnr year) vce(cluster bidnr)
test  d.l.ln_frac_taxpaidmc_y + d.l2.ln_frac_taxpaidmc_y + d.l3.ln_frac_taxpaidmc_y =0

reghdfe d.ln_zq d.l.ln_frac_taxpaidmc_y d.l2.ln_frac_taxpaidmc_y d.l3.ln_frac_taxpaidmc_y if d5_d8_firm==1,a(bidnr year) vce(cluster bidnr)
test  d.l.ln_frac_taxpaidmc_y + d.l2.ln_frac_taxpaidmc_y + d.l3.ln_frac_taxpaidmc_y =0

reghdfe d.ln_zq d.l.ln_frac_taxpaidmc_y d.l2.ln_frac_taxpaidmc_y d.l3.ln_frac_taxpaidmc_y if d9_d10_firm==1,a(bidnr year) vce(cluster bidnr)
test  d.l.ln_frac_taxpaidmc_y + d.l2.ln_frac_taxpaidmc_y + d.l3.ln_frac_taxpaidmc_y =0


************TABLE 5
reghdfe d.ln_zq d.l.ln_frac_taxpaidmc_y d.l2.ln_frac_taxpaidmc_y d.l3.ln_frac_taxpaidmc_y eu d.l.ln_frac_taxpaidmc_y_eu d.l2.ln_frac_taxpaidmc_y_eu d.l3.ln_frac_taxpaidmc_y_eu,a(bidnr year) vce(cluster bidnr)
test  d.l.ln_frac_taxpaidmc_y + d.l2.ln_frac_taxpaidmc_y + d.l3.ln_frac_taxpaidmc_y + d.l.ln_frac_taxpaidmc_y_eu + d.l2.ln_frac_taxpaidmc_y_eu + d.l3.ln_frac_taxpaidmc_y_eu =0

reghdfe d.ln_zq d.l.ln_frac_taxpaidmc_y d.l2.ln_frac_taxpaidmc_y d.l3.ln_frac_taxpaidmc_y eu d.l.ln_frac_taxpaidmc_y_eu d.l2.ln_frac_taxpaidmc_y_eu d.l3.ln_frac_taxpaidmc_y_eu if d9_d10_firm==1,a(bidnr year) vce(cluster bidnr)
test  d.l.ln_frac_taxpaidmc_y + d.l2.ln_frac_taxpaidmc_y + d.l3.ln_frac_taxpaidmc_y + d.l.ln_frac_taxpaidmc_y_eu + d.l2.ln_frac_taxpaidmc_y_eu + d.l3.ln_frac_taxpaidmc_y_eu =0

reghdfe d.ln_zq d.l.ln_frac_taxpaidmc_y d.l2.ln_frac_taxpaidmc_y d.l3.ln_frac_taxpaidmc_y d.l.ln_frac_inc_taxes_y d.l2.ln_frac_inc_taxes_y d.l3.ln_frac_inc_taxes_y,a(bidnr year) vce(cluster bidnr)
test d.l.ln_frac_taxpaidmc_y + d.l2.ln_frac_taxpaidmc_y + d.l3.ln_frac_taxpaidmc_y =0

reghdfe d.ln_zq d.l.ln_frac_taxpaidmc_y d.l2.ln_frac_taxpaidmc_y d.l3.ln_frac_taxpaidmc_y d.l.ln_frac_labor_taxes_y d.l2.ln_frac_labor_taxes_y d.l3.ln_frac_labor_taxes_y,a(bidnr year) vce(cluster bidnr)
test d.l.ln_frac_taxpaidmc_y + d.l2.ln_frac_taxpaidmc_y + d.l3.ln_frac_taxpaidmc_y =0

reghdfe d.ln_zq d.l.ln_frac_taxpaidmc_y d.l2.ln_frac_taxpaidmc_y d.l3.ln_frac_taxpaidmc_y log_emp,a(bidnr year) vce(cluster bidnr)
test  d.l.ln_frac_taxpaidmc_y + d.l2.ln_frac_taxpaidmc_y + d.l3.ln_frac_taxpaidmc_y =0

reghdfe d.ln_zq d.l.ln_frac_taxpaidmc_y d.l2.ln_frac_taxpaidmc_y d.l3.ln_frac_taxpaidmc_y d.log_cap_emp_use,a(bidnr year) vce(cluster bidnr)
test  d.l.ln_frac_taxpaidmc_y + d.l2.ln_frac_taxpaidmc_y + d.l3.ln_frac_taxpaidmc_y =0

reghdfe d.ln_zq d.l.ln_frac_taxpaidmc_y d.l2.ln_frac_taxpaidmc_y d.l3.ln_frac_taxpaidmc_y log_emp d.log_cap_emp_use,a(bidnr year) vce(cluster bidnr)
test  d.l.ln_frac_taxpaidmc_y + d.l2.ln_frac_taxpaidmc_y + d.l3.ln_frac_taxpaidmc_y =0

************TABLE 6
reghdfe d.ln_zq d.l.ln_frac_taxpaidmc_y d.l2.ln_frac_taxpaidmc_y d.l3.ln_frac_taxpaidmc_y if lp_firm==1,a(bidnr year) vce(cluster bidnr)
test  d.l.ln_frac_taxpaidmc_y + d.l2.ln_frac_taxpaidmc_y + d.l3.ln_frac_taxpaidmc_y =0

reghdfe d.ln_zq d.l.ln_frac_taxpaidmc_y d.l2.ln_frac_taxpaidmc_y d.l3.ln_frac_taxpaidmc_y if hp_firm==1,a(bidnr year) vce(cluster bidnr)
test  d.l.ln_frac_taxpaidmc_y + d.l2.ln_frac_taxpaidmc_y + d.l3.ln_frac_taxpaidmc_y =0

reghdfe d.ln_zq d.l.ln_frac_taxpaidmc_y d.l2.ln_frac_taxpaidmc_y d.l3.ln_frac_taxpaidmc_y if lp_lm_firm==1,a(bidnr year) vce(cluster bidnr)
test  d.l.ln_frac_taxpaidmc_y + d.l2.ln_frac_taxpaidmc_y + d.l3.ln_frac_taxpaidmc_y =0

reghdfe d.ln_zq d.l.ln_frac_taxpaidmc_y d.l2.ln_frac_taxpaidmc_y d.l3.ln_frac_taxpaidmc_y if lp_hm_firm==1,a(bidnr year) vce(cluster bidnr)
test  d.l.ln_frac_taxpaidmc_y + d.l2.ln_frac_taxpaidmc_y + d.l3.ln_frac_taxpaidmc_y =0

reghdfe d.ln_zq d.l.ln_frac_taxpaidmc_y d.l2.ln_frac_taxpaidmc_y d.l3.ln_frac_taxpaidmc_y if hp_lm_firm==1,a(bidnr year) vce(cluster bidnr)
test  d.l.ln_frac_taxpaidmc_y + d.l2.ln_frac_taxpaidmc_y + d.l3.ln_frac_taxpaidmc_y =0

reghdfe d.ln_zq d.l.ln_frac_taxpaidmc_y d.l2.ln_frac_taxpaidmc_y d.l3.ln_frac_taxpaidmc_y if hp_hm_firm==1,a(bidnr year) vce(cluster bidnr)
test  d.l.ln_frac_taxpaidmc_y + d.l2.ln_frac_taxpaidmc_y + d.l3.ln_frac_taxpaidmc_y =0

************TABLE 7
reghdfe d.ln_zq d.l.ln_frac_taxpaidmc_y d.l2.ln_frac_taxpaidmc_y d.l3.ln_frac_taxpaidmc_y if no_leakage_firm ==1,a(bidnr year) vce(cluster bidnr)
test  d.l.ln_frac_taxpaidmc_y + d.l2.ln_frac_taxpaidmc_y + d.l3.ln_frac_taxpaidmc_y =0

reghdfe d.ln_zq d.l.ln_frac_taxpaidmc_y d.l2.ln_frac_taxpaidmc_y d.l3.ln_frac_taxpaidmc_y if leakage_firm ==1,a(bidnr year) vce(cluster bidnr)
test  d.l.ln_frac_taxpaidmc_y + d.l2.ln_frac_taxpaidmc_y + d.l3.ln_frac_taxpaidmc_y =0

reghdfe d.ln_zq d.l.ln_frac_taxpaidmc_y d.l2.ln_frac_taxpaidmc_y d.l3.ln_frac_taxpaidmc_y if leakage_trade_only_firm ==1,a(bidnr year) vce(cluster bidnr)
test  d.l.ln_frac_taxpaidmc_y + d.l2.ln_frac_taxpaidmc_y + d.l3.ln_frac_taxpaidmc_y =0

reghdfe d.ln_zq d.l.ln_frac_taxpaidmc_y d.l2.ln_frac_taxpaidmc_y d.l3.ln_frac_taxpaidmc_y if leakage_not_trade_only_firm ==1,a(bidnr year) vce(cluster bidnr)
test  d.l.ln_frac_taxpaidmc_y + d.l2.ln_frac_taxpaidmc_y + d.l3.ln_frac_taxpaidmc_y =0

************TABLE 8 ****SAMPLE 1996-2015***

***PANEL A (SUM OF COEFFICIENTS FROM TABLE B.6)
reghdfe d.ln_zq d.l.ln_frac_taxpaidmc_y d.l2.ln_frac_taxpaidmc_y d.l3.ln_frac_taxpaidmc_y if public_firm==1,a(bidnr year) vce(cluster bidnr)
test  d.l.ln_frac_taxpaidmc_y + d.l2.ln_frac_taxpaidmc_y + d.l3.ln_frac_taxpaidmc_y =0

reghdfe d.ln_zq d.l.ln_frac_taxpaidmc_y d.l2.ln_frac_taxpaidmc_y d.l3.ln_frac_taxpaidmc_y if private_firm==1,a(bidnr year) vce(cluster bidnr)
test  d.l.ln_frac_taxpaidmc_y + d.l2.ln_frac_taxpaidmc_y + d.l3.ln_frac_taxpaidmc_y =0

reghdfe d.ln_zq d.l.ln_frac_taxpaidmc_y d.l2.ln_frac_taxpaidmc_y d.l3.ln_frac_taxpaidmc_y if public_firm==1 & d1_d4_firm==1,a(bidnr year) vce(cluster bidnr)
test  d.l.ln_frac_taxpaidmc_y + d.l2.ln_frac_taxpaidmc_y + d.l3.ln_frac_taxpaidmc_y =0

reghdfe d.ln_zq d.l.ln_frac_taxpaidmc_y d.l2.ln_frac_taxpaidmc_y d.l3.ln_frac_taxpaidmc_y if private_firm==1 & d1_d4_firm==1,a(bidnr year) vce(cluster bidnr)
test  d.l.ln_frac_taxpaidmc_y + d.l2.ln_frac_taxpaidmc_y + d.l3.ln_frac_taxpaidmc_y =0

reghdfe d.ln_zq d.l.ln_frac_taxpaidmc_y d.l2.ln_frac_taxpaidmc_y d.l3.ln_frac_taxpaidmc_y if public_firm==1 & d9_d10_firm==1,a(bidnr year) vce(cluster bidnr)
test  d.l.ln_frac_taxpaidmc_y + d.l2.ln_frac_taxpaidmc_y + d.l3.ln_frac_taxpaidmc_y =0

reghdfe d.ln_zq d.l.ln_frac_taxpaidmc_y d.l2.ln_frac_taxpaidmc_y d.l3.ln_frac_taxpaidmc_y if private_firm==1 & d9_d10_firm==1,a(bidnr year) vce(cluster bidnr)
test  d.l.ln_frac_taxpaidmc_y + d.l2.ln_frac_taxpaidmc_y + d.l3.ln_frac_taxpaidmc_y =0

reghdfe d.ln_zq d.l.ln_frac_taxpaidmc_y d.l2.ln_frac_taxpaidmc_y d.l3.ln_frac_taxpaidmc_y if public_firm==1 & lp_firm==1,a(bidnr year) vce(cluster bidnr)
test  d.l.ln_frac_taxpaidmc_y + d.l2.ln_frac_taxpaidmc_y + d.l3.ln_frac_taxpaidmc_y =0

reghdfe d.ln_zq d.l.ln_frac_taxpaidmc_y d.l2.ln_frac_taxpaidmc_y d.l3.ln_frac_taxpaidmc_y if private_firm==1 & lp_firm==1,a(bidnr year) vce(cluster bidnr)
test  d.l.ln_frac_taxpaidmc_y + d.l2.ln_frac_taxpaidmc_y + d.l3.ln_frac_taxpaidmc_y =0

reghdfe d.ln_zq d.l.ln_frac_taxpaidmc_y d.l2.ln_frac_taxpaidmc_y d.l3.ln_frac_taxpaidmc_y if public_firm==1 & hp_firm==1,a(bidnr year) vce(cluster bidnr)
test  d.l.ln_frac_taxpaidmc_y + d.l2.ln_frac_taxpaidmc_y + d.l3.ln_frac_taxpaidmc_y =0

reghdfe d.ln_zq d.l.ln_frac_taxpaidmc_y d.l2.ln_frac_taxpaidmc_y d.l3.ln_frac_taxpaidmc_y if private_firm==1 & hp_firm==1,a(bidnr year) vce(cluster bidnr)
test  d.l.ln_frac_taxpaidmc_y + d.l2.ln_frac_taxpaidmc_y + d.l3.ln_frac_taxpaidmc_y =0

***PANEL B (SUM OF COEFFICIENTS FROM TABLE B.7)
reghdfe d.ln_zq d.l.ln_frac_taxpaidmc_y d.l2.ln_frac_taxpaidmc_y d.l3.ln_frac_taxpaidmc_y if large_firm==1,a(bidnr year) vce(cluster bidnr)
test  d.l.ln_frac_taxpaidmc_y + d.l2.ln_frac_taxpaidmc_y + d.l3.ln_frac_taxpaidmc_y =0

reghdfe d.ln_zq d.l.ln_frac_taxpaidmc_y d.l2.ln_frac_taxpaidmc_y d.l3.ln_frac_taxpaidmc_y if small_firm==1,a(bidnr year) vce(cluster bidnr)
test  d.l.ln_frac_taxpaidmc_y + d.l2.ln_frac_taxpaidmc_y + d.l3.ln_frac_taxpaidmc_y =0

reghdfe d.ln_zq d.l.ln_frac_taxpaidmc_y d.l2.ln_frac_taxpaidmc_y d.l3.ln_frac_taxpaidmc_y if large_firm==1 & d1_d4_firm==1,a(bidnr year) vce(cluster bidnr)
test  d.l.ln_frac_taxpaidmc_y + d.l2.ln_frac_taxpaidmc_y + d.l3.ln_frac_taxpaidmc_y =0

reghdfe d.ln_zq d.l.ln_frac_taxpaidmc_y d.l2.ln_frac_taxpaidmc_y d.l3.ln_frac_taxpaidmc_y if small_firm==1 & d1_d4_firm==1,a(bidnr year) vce(cluster bidnr)
test  d.l.ln_frac_taxpaidmc_y + d.l2.ln_frac_taxpaidmc_y + d.l3.ln_frac_taxpaidmc_y =0

reghdfe d.ln_zq d.l.ln_frac_taxpaidmc_y d.l2.ln_frac_taxpaidmc_y d.l3.ln_frac_taxpaidmc_y if large_firm==1 & d9_d10_firm==1,a(bidnr year) vce(cluster bidnr)
test  d.l.ln_frac_taxpaidmc_y + d.l2.ln_frac_taxpaidmc_y + d.l3.ln_frac_taxpaidmc_y =0

reghdfe d.ln_zq d.l.ln_frac_taxpaidmc_y d.l2.ln_frac_taxpaidmc_y d.l3.ln_frac_taxpaidmc_y if small_firm==1 & d9_d10_firm==1,a(bidnr year) vce(cluster bidnr)
test  d.l.ln_frac_taxpaidmc_y + d.l2.ln_frac_taxpaidmc_y + d.l3.ln_frac_taxpaidmc_y =0

reghdfe d.ln_zq d.l.ln_frac_taxpaidmc_y d.l2.ln_frac_taxpaidmc_y d.l3.ln_frac_taxpaidmc_y if large_firm==1 & lp_firm==1,a(bidnr year) vce(cluster bidnr)
test  d.l.ln_frac_taxpaidmc_y + d.l2.ln_frac_taxpaidmc_y + d.l3.ln_frac_taxpaidmc_y =0

reghdfe d.ln_zq d.l.ln_frac_taxpaidmc_y d.l2.ln_frac_taxpaidmc_y d.l3.ln_frac_taxpaidmc_y if small_firm==1 & lp_firm==1,a(bidnr year) vce(cluster bidnr)
test  d.l.ln_frac_taxpaidmc_y + d.l2.ln_frac_taxpaidmc_y + d.l3.ln_frac_taxpaidmc_y =0

reghdfe d.ln_zq d.l.ln_frac_taxpaidmc_y d.l2.ln_frac_taxpaidmc_y d.l3.ln_frac_taxpaidmc_y if large_firm==1 & hp_firm==1,a(bidnr year) vce(cluster bidnr)
test  d.l.ln_frac_taxpaidmc_y + d.l2.ln_frac_taxpaidmc_y + d.l3.ln_frac_taxpaidmc_y =0

reghdfe d.ln_zq d.l.ln_frac_taxpaidmc_y d.l2.ln_frac_taxpaidmc_y d.l3.ln_frac_taxpaidmc_y if small_firm==1 & hp_firm==1,a(bidnr year) vce(cluster bidnr)
test  d.l.ln_frac_taxpaidmc_y + d.l2.ln_frac_taxpaidmc_y + d.l3.ln_frac_taxpaidmc_y =0

***PANEL C (SUM OF COEFFICIENTS FROM TABLE B.8)
reghdfe d.ln_zq d.l.ln_frac_taxpaidmc_y d.l2.ln_frac_taxpaidmc_y d.l3.ln_frac_taxpaidmc_y if high_div_firm==1,a(bidnr year) vce(cluster bidnr)
test  d.l.ln_frac_taxpaidmc_y + d.l2.ln_frac_taxpaidmc_y + d.l3.ln_frac_taxpaidmc_y =0

reghdfe d.ln_zq d.l.ln_frac_taxpaidmc_y d.l2.ln_frac_taxpaidmc_y d.l3.ln_frac_taxpaidmc_y if low_div_firm==1,a(bidnr year) vce(cluster bidnr)
test  d.l.ln_frac_taxpaidmc_y + d.l2.ln_frac_taxpaidmc_y + d.l3.ln_frac_taxpaidmc_y =0

reghdfe d.ln_zq d.l.ln_frac_taxpaidmc_y d.l2.ln_frac_taxpaidmc_y d.l3.ln_frac_taxpaidmc_y if high_div_firm==1 & d1_d4_firm==1,a(bidnr year) vce(cluster bidnr)
test  d.l.ln_frac_taxpaidmc_y + d.l2.ln_frac_taxpaidmc_y + d.l3.ln_frac_taxpaidmc_y =0

reghdfe d.ln_zq d.l.ln_frac_taxpaidmc_y d.l2.ln_frac_taxpaidmc_y d.l3.ln_frac_taxpaidmc_y if low_div_firm==1 & d1_d4_firm==1,a(bidnr year) vce(cluster bidnr)
test  d.l.ln_frac_taxpaidmc_y + d.l2.ln_frac_taxpaidmc_y + d.l3.ln_frac_taxpaidmc_y =0

reghdfe d.ln_zq d.l.ln_frac_taxpaidmc_y d.l2.ln_frac_taxpaidmc_y d.l3.ln_frac_taxpaidmc_y if high_div_firm==1 & d9_d10_firm==1,a(bidnr year) vce(cluster bidnr)
test  d.l.ln_frac_taxpaidmc_y + d.l2.ln_frac_taxpaidmc_y + d.l3.ln_frac_taxpaidmc_y =0

reghdfe d.ln_zq d.l.ln_frac_taxpaidmc_y d.l2.ln_frac_taxpaidmc_y d.l3.ln_frac_taxpaidmc_y if low_div_firm==1 & d9_d10_firm==1,a(bidnr year) vce(cluster bidnr)
test  d.l.ln_frac_taxpaidmc_y + d.l2.ln_frac_taxpaidmc_y + d.l3.ln_frac_taxpaidmc_y =0

reghdfe d.ln_zq d.l.ln_frac_taxpaidmc_y d.l2.ln_frac_taxpaidmc_y d.l3.ln_frac_taxpaidmc_y if high_div_firm==1 & lp_firm==1,a(bidnr year) vce(cluster bidnr)
test  d.l.ln_frac_taxpaidmc_y + d.l2.ln_frac_taxpaidmc_y + d.l3.ln_frac_taxpaidmc_y =0

reghdfe d.ln_zq d.l.ln_frac_taxpaidmc_y d.l2.ln_frac_taxpaidmc_y d.l3.ln_frac_taxpaidmc_y if low_div_firm==1 & lp_firm==1,a(bidnr year) vce(cluster bidnr)
test  d.l.ln_frac_taxpaidmc_y + d.l2.ln_frac_taxpaidmc_y + d.l3.ln_frac_taxpaidmc_y =0

reghdfe d.ln_zq d.l.ln_frac_taxpaidmc_y d.l2.ln_frac_taxpaidmc_y d.l3.ln_frac_taxpaidmc_y if high_div_firm==1 & hp_firm==1,a(bidnr year) vce(cluster bidnr)
test  d.l.ln_frac_taxpaidmc_y + d.l2.ln_frac_taxpaidmc_y + d.l3.ln_frac_taxpaidmc_y =0

reghdfe d.ln_zq d.l.ln_frac_taxpaidmc_y d.l2.ln_frac_taxpaidmc_y d.l3.ln_frac_taxpaidmc_y if low_div_firm==1 & hp_firm==1,a(bidnr year) vce(cluster bidnr)
test  d.l.ln_frac_taxpaidmc_y + d.l2.ln_frac_taxpaidmc_y + d.l3.ln_frac_taxpaidmc_y =0

***PANEL D (SUM OF COEFFICIENTS FROM TABLE B.9)
reghdfe d.ln_zq d.l.ln_frac_taxpaidmc_y d.l2.ln_frac_taxpaidmc_y d.l3.ln_frac_taxpaidmc_y if mature_firm==1,a(bidnr year) vce(cluster bidnr)
test  d.l.ln_frac_taxpaidmc_y + d.l2.ln_frac_taxpaidmc_y + d.l3.ln_frac_taxpaidmc_y =0

reghdfe d.ln_zq d.l.ln_frac_taxpaidmc_y d.l2.ln_frac_taxpaidmc_y d.l3.ln_frac_taxpaidmc_y if young_firm==1,a(bidnr year) vce(cluster bidnr)
test  d.l.ln_frac_taxpaidmc_y + d.l2.ln_frac_taxpaidmc_y + d.l3.ln_frac_taxpaidmc_y =0

reghdfe d.ln_zq d.l.ln_frac_taxpaidmc_y d.l2.ln_frac_taxpaidmc_y d.l3.ln_frac_taxpaidmc_y if mature_firm==1 & d1_d4_firm==1,a(bidnr year) vce(cluster bidnr)
test  d.l.ln_frac_taxpaidmc_y + d.l2.ln_frac_taxpaidmc_y + d.l3.ln_frac_taxpaidmc_y =0

reghdfe d.ln_zq d.l.ln_frac_taxpaidmc_y d.l2.ln_frac_taxpaidmc_y d.l3.ln_frac_taxpaidmc_y if young_firm==1 & d1_d4_firm==1,a(bidnr year) vce(cluster bidnr)
test  d.l.ln_frac_taxpaidmc_y + d.l2.ln_frac_taxpaidmc_y + d.l3.ln_frac_taxpaidmc_y =0

reghdfe d.ln_zq d.l.ln_frac_taxpaidmc_y d.l2.ln_frac_taxpaidmc_y d.l3.ln_frac_taxpaidmc_y if mature_firm==1 & d9_d10_firm==1,a(bidnr year) vce(cluster bidnr)
test  d.l.ln_frac_taxpaidmc_y + d.l2.ln_frac_taxpaidmc_y + d.l3.ln_frac_taxpaidmc_y =0

reghdfe d.ln_zq d.l.ln_frac_taxpaidmc_y d.l2.ln_frac_taxpaidmc_y d.l3.ln_frac_taxpaidmc_y if young_firm==1 & d9_d10_firm==1,a(bidnr year) vce(cluster bidnr)
test  d.l.ln_frac_taxpaidmc_y + d.l2.ln_frac_taxpaidmc_y + d.l3.ln_frac_taxpaidmc_y =0

reghdfe d.ln_zq d.l.ln_frac_taxpaidmc_y d.l2.ln_frac_taxpaidmc_y d.l3.ln_frac_taxpaidmc_y if mature_firm==1 & lp_firm==1,a(bidnr year) vce(cluster bidnr)
test  d.l.ln_frac_taxpaidmc_y + d.l2.ln_frac_taxpaidmc_y + d.l3.ln_frac_taxpaidmc_y =0

reghdfe d.ln_zq d.l.ln_frac_taxpaidmc_y d.l2.ln_frac_taxpaidmc_y d.l3.ln_frac_taxpaidmc_y if young_firm==1 & lp_firm==1,a(bidnr year) vce(cluster bidnr)
test  d.l.ln_frac_taxpaidmc_y + d.l2.ln_frac_taxpaidmc_y + d.l3.ln_frac_taxpaidmc_y =0

reghdfe d.ln_zq d.l.ln_frac_taxpaidmc_y d.l2.ln_frac_taxpaidmc_y d.l3.ln_frac_taxpaidmc_y if mature_firm==1 & hp_firm==1,a(bidnr year) vce(cluster bidnr)
test  d.l.ln_frac_taxpaidmc_y + d.l2.ln_frac_taxpaidmc_y + d.l3.ln_frac_taxpaidmc_y =0

reghdfe d.ln_zq d.l.ln_frac_taxpaidmc_y d.l2.ln_frac_taxpaidmc_y d.l3.ln_frac_taxpaidmc_y if young_firm==1 & hp_firm==1,a(bidnr year) vce(cluster bidnr)
test  d.l.ln_frac_taxpaidmc_y + d.l2.ln_frac_taxpaidmc_y + d.l3.ln_frac_taxpaidmc_y =0

************TABLE 9

**************PANEL A*******
***FULL SAMPLE
tabstat z_q_1_w ln_frac_taxpaidmc_y, by(year)
tabstat kt_co2foss, by(year) stat(sum)

***LP LM
tabstat z_q_1_w ln_frac_taxpaidmc_y if lp_lm_firm==1, by(year)
tabstat kt_co2foss if lp_lm_firm==1, by(year) stat(sum)

***LP HM
tabstat z_q_1_w ln_frac_taxpaidmc_y if lp_hm_firm==1, by(year)
tabstat kt_co2foss if lp_hm_firm==1, by(year) stat(sum)

***HP LM
tabstat z_q_1_w ln_frac_taxpaidmc_y if hp_lm_firm==1, by(year)
tabstat kt_co2foss if hp_lm_firm==1, by(year) stat(sum)

***HP HM
tabstat z_q_1_w ln_frac_taxpaidmc_y if hp_hm_firm==1, by(year)
tabstat kt_co2foss if hp_hm_firm==1, by(year) stat(sum)

*************PANEL B*******
***LP
tabstat z_q_1_w ln_frac_taxpaidmc_y if lp_firm==1, by(year)
tabstat kt_co2foss if lp_firm==1, by(year) stat(sum)

***HP
tabstat z_q_1_w ln_frac_taxpaidmc_y if hp_firm==1, by(year)
tabstat kt_co2foss if hp_firm==1, by(year) stat(sum)

***NOT ON LEAKAGE LIST
tabstat z_q_1_w ln_frac_taxpaidmc_y if no_leakage_firm==1, by(year)
tabstat kt_co2foss if no_leakage_firm==1, by(year) stat(sum)

***ON LEAKAGE LIST
tabstat z_q_1_w ln_frac_taxpaidmc_y if leakage_firm==1, by(year)
tabstat kt_co2foss if leakage_firm==1, by(year) stat(sum)

***D1 D4
tabstat z_q_1_w ln_frac_taxpaidmc_y if d1_d4_firm==1, by(year)
tabstat kt_co2foss if d1_d4_firm==1, by(year) stat(sum)

***D5 D8
tabstat z_q_1_w ln_frac_taxpaidmc_y if d5_d8_firm==1, by(year)
tabstat kt_co2foss if d5_d8_firm==1, by(year) stat(sum)

***D9 D10
tabstat z_q_1_w ln_frac_taxpaidmc_y if d9_d10_firm==1, by(year)
tabstat kt_co2foss if d9_d10_firm==1, by(year) stat(sum)

*************PANEL C******* ****SAMPLE 1996-2015***
***PUBLIC FIRM
tabstat z_q_1_w ln_frac_taxpaidmc_y if public_firm==1 & year>1995, by(year)
tabstat kt_co2foss if public_firm==1  & year>1995, by(year) stat(sum)

***PRIVATE FIRM
tabstat z_q_1_w ln_frac_taxpaidmc_y if private_firm==1  & year>1995, by(year)
tabstat kt_co2foss if public_firm==0  & year>1995, by(year) stat(sum)

***LARGE FIRM
tabstat z_q_1_w ln_frac_taxpaidmc_y if large_firm==1 & year>1995, by(year)
tabstat kt_co2foss if large_firm==1  & year>1995, by(year) stat(sum)

***SMALL FIRM
tabstat z_q_1_w ln_frac_taxpaidmc_y if small_firm==1  & year>1995, by(year)
tabstat kt_co2foss if small_firm==1  & year>1995, by(year) stat(sum)

***HIGH DIV FIRM
tabstat z_q_1_w ln_frac_taxpaidmc_y if high_div_firm==1 & year>1995, by(year)
tabstat kt_co2foss if high_div_firm==1  & year>1995, by(year) stat(sum)

***LOW DIV FIRM
tabstat z_q_1_w ln_frac_taxpaidmc_y if low_div_firm==1  & year>1995, by(year)
tabstat kt_co2foss if low_div_firm==1  & year>1995, by(year) stat(sum)

***MATURE FIRM
tabstat z_q_1_w ln_frac_taxpaidmc_y if mature_firm==1 & year>1995, by(year)
tabstat kt_co2foss if mature_firm==1  & year>1995, by(year) stat(sum)

***YOUNG FIRM
tabstat z_q_1_w ln_frac_taxpaidmc_y if young_firm==1  & year>1995, by(year)
tabstat kt_co2foss if young_firm==1  & year>1995, by(year) stat(sum)

******APPENDIX TABLES
***DECILES AND EI
tabstat ei_sum_90 if year==1990, by( sni2007_4d)

***TABLE B.5
reghdfe d.ln_zq d.l.ln_frac_taxpaidmc_y if d.l.ln_frac_taxpaidmc_y<. & d.l2.ln_frac_taxpaidmc_y<. & d.l3.ln_frac_taxpaidmc_y<.,a(year) vce(cluster bidnr)
test  d.l.ln_frac_taxpaidmc_y =0

reghdfe d.ln_zq d.l.ln_frac_taxpaidmc_y if d.l.ln_frac_taxpaidmc_y<. & d.l2.ln_frac_taxpaidmc_y<. & d.l3.ln_frac_taxpaidmc_y<.,a(bidnr year) vce(cluster bidnr)
test  d.l.ln_frac_taxpaidmc_y =0

reghdfe d.ln_zq d.l.ln_frac_taxpaidmc_y d.l2.ln_frac_taxpaidmc_y if d.l.ln_frac_taxpaidmc_y<. & d.l2.ln_frac_taxpaidmc_y<. & d.l3.ln_frac_taxpaidmc_y<.,a(bidnr year) vce(cluster bidnr)
test  d.l.ln_frac_taxpaidmc_y + d.l2.ln_frac_taxpaidmc_y =0

************REGRESSION OUTPUT FOR TABLE B.6 - B.9 SEE UNDER TABLE 8

************TABLE B.10 ****SAMPLE 1996-2015***
reghdfe d.ln_zq d.l.ln_frac_taxpaidmc_y d.l2.ln_frac_taxpaidmc_y d.l3.ln_frac_taxpaidmc_y if low_sa==1,a(bidnr year) vce(cluster bidnr)
test  d.l.ln_frac_taxpaidmc_y + d.l2.ln_frac_taxpaidmc_y + d.l3.ln_frac_taxpaidmc_y =0

reghdfe d.ln_zq d.l.ln_frac_taxpaidmc_y d.l2.ln_frac_taxpaidmc_y d.l3.ln_frac_taxpaidmc_y if high_sa==1,a(bidnr year) vce(cluster bidnr)
test  d.l.ln_frac_taxpaidmc_y + d.l2.ln_frac_taxpaidmc_y + d.l3.ln_frac_taxpaidmc_y =0

reghdfe d.ln_zq d.l.ln_frac_taxpaidmc_y d.l2.ln_frac_taxpaidmc_y d.l3.ln_frac_taxpaidmc_y if low_sa==1 & d9_d10_firm==1,a(bidnr year) vce(cluster bidnr)
test  d.l.ln_frac_taxpaidmc_y + d.l2.ln_frac_taxpaidmc_y + d.l3.ln_frac_taxpaidmc_y =0

reghdfe d.ln_zq d.l.ln_frac_taxpaidmc_y d.l2.ln_frac_taxpaidmc_y d.l3.ln_frac_taxpaidmc_y if high_sa==1 & d9_d10_firm==1,a(bidnr year) vce(cluster bidnr)
test  d.l.ln_frac_taxpaidmc_y + d.l2.ln_frac_taxpaidmc_y + d.l3.ln_frac_taxpaidmc_y =0

reghdfe d.ln_zq d.l.ln_frac_taxpaidmc_y d.l2.ln_frac_taxpaidmc_y d.l3.ln_frac_taxpaidmc_y if low_ww==1,a(bidnr year) vce(cluster bidnr)
test  d.l.ln_frac_taxpaidmc_y + d.l2.ln_frac_taxpaidmc_y + d.l3.ln_frac_taxpaidmc_y =0

reghdfe d.ln_zq d.l.ln_frac_taxpaidmc_y d.l2.ln_frac_taxpaidmc_y d.l3.ln_frac_taxpaidmc_y if high_ww==1,a(bidnr year) vce(cluster bidnr)
test  d.l.ln_frac_taxpaidmc_y + d.l2.ln_frac_taxpaidmc_y + d.l3.ln_frac_taxpaidmc_y =0

reghdfe d.ln_zq d.l.ln_frac_taxpaidmc_y d.l2.ln_frac_taxpaidmc_y d.l3.ln_frac_taxpaidmc_y if low_ww==1 & d9_d10_firm==1,a(bidnr year) vce(cluster bidnr)
test  d.l.ln_frac_taxpaidmc_y + d.l2.ln_frac_taxpaidmc_y + d.l3.ln_frac_taxpaidmc_y =0

reghdfe d.ln_zq d.l.ln_frac_taxpaidmc_y d.l2.ln_frac_taxpaidmc_y d.l3.ln_frac_taxpaidmc_y if high_ww==1 & d9_d10_firm==1,a(bidnr year) vce(cluster bidnr)
test  d.l.ln_frac_taxpaidmc_y + d.l2.ln_frac_taxpaidmc_y + d.l3.ln_frac_taxpaidmc_y =0


************TABLE B.11 ****SAMPLE 1996-2015***
reghdfe d.ln_zq d.l.ln_frac_taxpaidmc_y d.l2.ln_frac_taxpaidmc_y d.l3.ln_frac_taxpaidmc_y if public_firm_all==1,a(bidnr year) vce(cluster bidnr)
test  d.l.ln_frac_taxpaidmc_y + d.l2.ln_frac_taxpaidmc_y + d.l3.ln_frac_taxpaidmc_y =0

reghdfe d.ln_zq d.l.ln_frac_taxpaidmc_y d.l2.ln_frac_taxpaidmc_y d.l3.ln_frac_taxpaidmc_y if private_firm==1,a(bidnr year) vce(cluster bidnr)
test  d.l.ln_frac_taxpaidmc_y + d.l2.ln_frac_taxpaidmc_y + d.l3.ln_frac_taxpaidmc_y =0

reghdfe d.ln_zq d.l.ln_frac_taxpaidmc_y d.l2.ln_frac_taxpaidmc_y d.l3.ln_frac_taxpaidmc_y if public_firm_all==1 & d1_d4_firm==1,a(bidnr year) vce(cluster bidnr)
test  d.l.ln_frac_taxpaidmc_y + d.l2.ln_frac_taxpaidmc_y + d.l3.ln_frac_taxpaidmc_y =0

reghdfe d.ln_zq d.l.ln_frac_taxpaidmc_y d.l2.ln_frac_taxpaidmc_y d.l3.ln_frac_taxpaidmc_y if private_firm==1 & d1_d4_firm==1,a(bidnr year) vce(cluster bidnr)
test  d.l.ln_frac_taxpaidmc_y + d.l2.ln_frac_taxpaidmc_y + d.l3.ln_frac_taxpaidmc_y =0

reghdfe d.ln_zq d.l.ln_frac_taxpaidmc_y d.l2.ln_frac_taxpaidmc_y d.l3.ln_frac_taxpaidmc_y if public_firm_all==1 & d9_d10_firm==1,a(bidnr year) vce(cluster bidnr)
test  d.l.ln_frac_taxpaidmc_y + d.l2.ln_frac_taxpaidmc_y + d.l3.ln_frac_taxpaidmc_y =0

reghdfe d.ln_zq d.l.ln_frac_taxpaidmc_y d.l2.ln_frac_taxpaidmc_y d.l3.ln_frac_taxpaidmc_y if private_firm==1 & d9_d10_firm==1,a(bidnr year) vce(cluster bidnr)
test  d.l.ln_frac_taxpaidmc_y + d.l2.ln_frac_taxpaidmc_y + d.l3.ln_frac_taxpaidmc_y =0

reghdfe d.ln_zq d.l.ln_frac_taxpaidmc_y d.l2.ln_frac_taxpaidmc_y d.l3.ln_frac_taxpaidmc_y if public_firm_all==1 & lp_firm==1,a(bidnr year) vce(cluster bidnr)
test  d.l.ln_frac_taxpaidmc_y + d.l2.ln_frac_taxpaidmc_y + d.l3.ln_frac_taxpaidmc_y =0

reghdfe d.ln_zq d.l.ln_frac_taxpaidmc_y d.l2.ln_frac_taxpaidmc_y d.l3.ln_frac_taxpaidmc_y if private_firm==1 & lp_firm==1,a(bidnr year) vce(cluster bidnr)
test  d.l.ln_frac_taxpaidmc_y + d.l2.ln_frac_taxpaidmc_y + d.l3.ln_frac_taxpaidmc_y =0

reghdfe d.ln_zq d.l.ln_frac_taxpaidmc_y d.l2.ln_frac_taxpaidmc_y d.l3.ln_frac_taxpaidmc_y if public_firm_all==1 & hp_firm==1,a(bidnr year) vce(cluster bidnr)
test  d.l.ln_frac_taxpaidmc_y + d.l2.ln_frac_taxpaidmc_y + d.l3.ln_frac_taxpaidmc_y =0

reghdfe d.ln_zq d.l.ln_frac_taxpaidmc_y d.l2.ln_frac_taxpaidmc_y d.l3.ln_frac_taxpaidmc_y if private_firm==1 & hp_firm==1,a(bidnr year) vce(cluster bidnr)
test  d.l.ln_frac_taxpaidmc_y + d.l2.ln_frac_taxpaidmc_y + d.l3.ln_frac_taxpaidmc_y =0

************TABLE B.12 ****SAMPLE 1996-2015***
reghdfe d.ln_zq d.l.ln_frac_taxpaidmc_y d.l2.ln_frac_taxpaidmc_y d.l3.ln_frac_taxpaidmc_y if public_con==1,a(bidnr year) vce(cluster bidnr)
test  d.l.ln_frac_taxpaidmc_y + d.l2.ln_frac_taxpaidmc_y + d.l3.ln_frac_taxpaidmc_y =0

reghdfe d.ln_zq d.l.ln_frac_taxpaidmc_y d.l2.ln_frac_taxpaidmc_y d.l3.ln_frac_taxpaidmc_y if public_con==0,a(bidnr year) vce(cluster bidnr)
test  d.l.ln_frac_taxpaidmc_y + d.l2.ln_frac_taxpaidmc_y + d.l3.ln_frac_taxpaidmc_y =0

reghdfe d.ln_zq d.l.ln_frac_taxpaidmc_y d.l2.ln_frac_taxpaidmc_y d.l3.ln_frac_taxpaidmc_y if public_con==1 & d1_d4_firm==1,a(bidnr year) vce(cluster bidnr)
test  d.l.ln_frac_taxpaidmc_y + d.l2.ln_frac_taxpaidmc_y + d.l3.ln_frac_taxpaidmc_y =0

reghdfe d.ln_zq d.l.ln_frac_taxpaidmc_y d.l2.ln_frac_taxpaidmc_y d.l3.ln_frac_taxpaidmc_y if public_con==0 & d1_d4_firm==1,a(bidnr year) vce(cluster bidnr)
test  d.l.ln_frac_taxpaidmc_y + d.l2.ln_frac_taxpaidmc_y + d.l3.ln_frac_taxpaidmc_y =0

reghdfe d.ln_zq d.l.ln_frac_taxpaidmc_y d.l2.ln_frac_taxpaidmc_y d.l3.ln_frac_taxpaidmc_y if public_con==1 & d9_d10_firm==1,a(bidnr year) vce(cluster bidnr)
test  d.l.ln_frac_taxpaidmc_y + d.l2.ln_frac_taxpaidmc_y + d.l3.ln_frac_taxpaidmc_y =0

reghdfe d.ln_zq d.l.ln_frac_taxpaidmc_y d.l2.ln_frac_taxpaidmc_y d.l3.ln_frac_taxpaidmc_y if public_con==0 & d9_d10_firm==1,a(bidnr year) vce(cluster bidnr)
test  d.l.ln_frac_taxpaidmc_y + d.l2.ln_frac_taxpaidmc_y + d.l3.ln_frac_taxpaidmc_y =0

reghdfe d.ln_zq d.l.ln_frac_taxpaidmc_y d.l2.ln_frac_taxpaidmc_y d.l3.ln_frac_taxpaidmc_y if public_con==1 & lp_firm==1,a(bidnr year) vce(cluster bidnr)
test  d.l.ln_frac_taxpaidmc_y + d.l2.ln_frac_taxpaidmc_y + d.l3.ln_frac_taxpaidmc_y =0

reghdfe d.ln_zq d.l.ln_frac_taxpaidmc_y d.l2.ln_frac_taxpaidmc_y d.l3.ln_frac_taxpaidmc_y if public_con==0 & lp_firm==1,a(bidnr year) vce(cluster bidnr)
test  d.l.ln_frac_taxpaidmc_y + d.l2.ln_frac_taxpaidmc_y + d.l3.ln_frac_taxpaidmc_y =0

reghdfe d.ln_zq d.l.ln_frac_taxpaidmc_y d.l2.ln_frac_taxpaidmc_y d.l3.ln_frac_taxpaidmc_y if public_con==1 & hp_firm==1,a(bidnr year) vce(cluster bidnr)
test  d.l.ln_frac_taxpaidmc_y + d.l2.ln_frac_taxpaidmc_y + d.l3.ln_frac_taxpaidmc_y =0

reghdfe d.ln_zq d.l.ln_frac_taxpaidmc_y d.l2.ln_frac_taxpaidmc_y d.l3.ln_frac_taxpaidmc_y if public_con==0 & hp_firm==1,a(bidnr year) vce(cluster bidnr)
test  d.l.ln_frac_taxpaidmc_y + d.l2.ln_frac_taxpaidmc_y + d.l3.ln_frac_taxpaidmc_y =0

***********TABLE B.13 ****SAMPLE 1996-2015***
reghdfe d.ln_zq d.l.ln_frac_taxpaidmc_y d.l2.ln_frac_taxpaidmc_y d.l3.ln_frac_taxpaidmc_y d.l.ln_frac_taxpaidmc_y_bc d.l2.ln_frac_taxpaidmc_y_bc d.l3.ln_frac_taxpaidmc_y_bc if public_firm==1,a(bidnr year) vce(cluster bidnr)
test  d.l.ln_frac_taxpaidmc_y + d.l2.ln_frac_taxpaidmc_y + d.l3.ln_frac_taxpaidmc_y =0
test  d.l.ln_frac_taxpaidmc_y_bc + d.l2.ln_frac_taxpaidmc_y_bc + d.l3.ln_frac_taxpaidmc_y_bc =0

reghdfe d.ln_zq d.l.ln_frac_taxpaidmc_y d.l2.ln_frac_taxpaidmc_y d.l3.ln_frac_taxpaidmc_y d.l.ln_frac_taxpaidmc_y_bc d.l2.ln_frac_taxpaidmc_y_bc d.l3.ln_frac_taxpaidmc_y_bc if private_firm==1,a(bidnr year) vce(cluster bidnr)
test  d.l.ln_frac_taxpaidmc_y + d.l2.ln_frac_taxpaidmc_y + d.l3.ln_frac_taxpaidmc_y =0
test  d.l.ln_frac_taxpaidmc_y_bc + d.l2.ln_frac_taxpaidmc_y_bc + d.l3.ln_frac_taxpaidmc_y_bc =0

reghdfe d.ln_zq d.l.ln_frac_taxpaidmc_y d.l2.ln_frac_taxpaidmc_y d.l3.ln_frac_taxpaidmc_y d.l.ln_frac_taxpaidmc_y_bc d.l2.ln_frac_taxpaidmc_y_bc d.l3.ln_frac_taxpaidmc_y_bc if large_firm==1,a(bidnr year) vce(cluster bidnr)
test  d.l.ln_frac_taxpaidmc_y + d.l2.ln_frac_taxpaidmc_y + d.l3.ln_frac_taxpaidmc_y =0
test  d.l.ln_frac_taxpaidmc_y_bc + d.l2.ln_frac_taxpaidmc_y_bc + d.l3.ln_frac_taxpaidmc_y_bc =0

reghdfe d.ln_zq d.l.ln_frac_taxpaidmc_y d.l2.ln_frac_taxpaidmc_y d.l3.ln_frac_taxpaidmc_y d.l.ln_frac_taxpaidmc_y_bc d.l2.ln_frac_taxpaidmc_y_bc d.l3.ln_frac_taxpaidmc_y_bc if small_firm==1,a(bidnr year) vce(cluster bidnr)
test  d.l.ln_frac_taxpaidmc_y + d.l2.ln_frac_taxpaidmc_y + d.l3.ln_frac_taxpaidmc_y =0
test  d.l.ln_frac_taxpaidmc_y_bc + d.l2.ln_frac_taxpaidmc_y_bc + d.l3.ln_frac_taxpaidmc_y_bc =0

reghdfe d.ln_zq d.l.ln_frac_taxpaidmc_y d.l2.ln_frac_taxpaidmc_y d.l3.ln_frac_taxpaidmc_y d.l.ln_frac_taxpaidmc_y_bc d.l2.ln_frac_taxpaidmc_y_bc d.l3.ln_frac_taxpaidmc_y_bc if high_div_firm==1,a(bidnr year) vce(cluster bidnr)
test  d.l.ln_frac_taxpaidmc_y + d.l2.ln_frac_taxpaidmc_y + d.l3.ln_frac_taxpaidmc_y =0
test  d.l.ln_frac_taxpaidmc_y_bc + d.l2.ln_frac_taxpaidmc_y_bc + d.l3.ln_frac_taxpaidmc_y_bc =0

reghdfe d.ln_zq d.l.ln_frac_taxpaidmc_y d.l2.ln_frac_taxpaidmc_y d.l3.ln_frac_taxpaidmc_y d.l.ln_frac_taxpaidmc_y_bc d.l2.ln_frac_taxpaidmc_y_bc d.l3.ln_frac_taxpaidmc_y_bc if low_div_firm==1,a(bidnr year) vce(cluster bidnr)
test  d.l.ln_frac_taxpaidmc_y + d.l2.ln_frac_taxpaidmc_y + d.l3.ln_frac_taxpaidmc_y =0
test  d.l.ln_frac_taxpaidmc_y_bc + d.l2.ln_frac_taxpaidmc_y_bc + d.l3.ln_frac_taxpaidmc_y_bc =0

reghdfe d.ln_zq d.l.ln_frac_taxpaidmc_y d.l2.ln_frac_taxpaidmc_y d.l3.ln_frac_taxpaidmc_y d.l.ln_frac_taxpaidmc_y_bc d.l2.ln_frac_taxpaidmc_y_bc d.l3.ln_frac_taxpaidmc_y_bc if mature_firm==1,a(bidnr year) vce(cluster bidnr)
test  d.l.ln_frac_taxpaidmc_y + d.l2.ln_frac_taxpaidmc_y + d.l3.ln_frac_taxpaidmc_y =0
test  d.l.ln_frac_taxpaidmc_y_bc + d.l2.ln_frac_taxpaidmc_y_bc + d.l3.ln_frac_taxpaidmc_y_bc =0

reghdfe d.ln_zq d.l.ln_frac_taxpaidmc_y d.l2.ln_frac_taxpaidmc_y d.l3.ln_frac_taxpaidmc_y d.l.ln_frac_taxpaidmc_y_bc d.l2.ln_frac_taxpaidmc_y_bc d.l3.ln_frac_taxpaidmc_y_bc if young_firm==1,a(bidnr year) vce(cluster bidnr)
test  d.l.ln_frac_taxpaidmc_y + d.l2.ln_frac_taxpaidmc_y + d.l3.ln_frac_taxpaidmc_y =0
test  d.l.ln_frac_taxpaidmc_y_bc + d.l2.ln_frac_taxpaidmc_y_bc + d.l3.ln_frac_taxpaidmc_y_bc =0





